package com.larsgard.gedviewer.server.storage.entities;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.larsgard.gedviewer.shared.Feedback;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class JDOFeedback implements PersitenceCapable {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    @Persistent
    private String from;
    @Persistent
    private String feedback;

    @Override
    public Key getKey() {
	return key;
    }

    @Override
    public void setKey(Key key) {
	this.key = key;
    }

    public void setFrom(String from) {
	this.from = from;
    }

    public String getFrom() {
	return from;
    }

    public void setFeedback(String feedback) {
	this.feedback = feedback;
    }

    public String getFeedback() {
	return feedback;
    }

    public static JDOFeedback fromFeedBack(Feedback feedback) {
	JDOFeedback result = new JDOFeedback();
	result.setFrom(feedback.getFrom());
	result.setFeedback(feedback.getFeedback());
	return result;
    }

}
